package com.mall.service.impl;

import com.mall.mapper.ReturnlistMapper;
import com.mall.po.Returnlist;
import com.mall.service.ReturnlistService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName ReturnlistServiceImpl
 * @Description TODO
 * @action luoliang
 * @Data 2021/1/6 11:21
 * @Version 1.0
 */
@Service
public class ReturnlistServiceImpl implements ReturnlistService {

    @Autowired
    private ReturnlistMapper returnlistMapper;

    /**
     * 通过id删除
     * @param deliverid
     * @return
     */
    @Override
    public int deleteByid(Integer deliverid) {
        int i = returnlistMapper.deleteByPrimaryKey(deliverid);
        return i;
    }

    /**
     * 添加
     * @param record
     * @return
     */
    @Override
    public int insertInvoice(Returnlist record) {
        int insert = returnlistMapper.insert(record);
        return insert;
    }

    /**
     * 添加选择
     * @param record
     * @return
     */
    @Override
    public int insertSelect(Returnlist record) {
        int i = returnlistMapper.insertSelective(record);
        return i;
    }

    /**
     * 通过id查询
     * @param deliverid
     * @return
     */
    @Override
    public Returnlist selectByid(Integer deliverid) {
        Returnlist returnlist = returnlistMapper.selectByPrimaryKey(deliverid);
        return returnlist;
    }

    /**
     * 选择修改
     * @param record
     * @return
     */
    @Override
    public int updateByInvoice(Returnlist record) {
        int i = returnlistMapper.updateByPrimaryKeySelective(record);
        return i;
    }

    /**
     * 修改
     * @param record
     * @return
     */
    @Override
    public int updateInvoice(Returnlist record) {
        int i = returnlistMapper.updateByPrimaryKey(record);
        return i;
    }

    /**
     * 批量删除
     * @param deliverids
     * @return
     */
    @Override
    public boolean delectReturnByids(Integer[] deliverids) {
        boolean b = returnlistMapper.deleteByids(deliverids);
        return b;
    }

    /**
     * 分页
     * @param page
     * @param pagesize
     * @return
     */
    @Override
    public List<Returnlist> selectReturnPage(int page, int pagesize) {
        List<Returnlist> returnlists = returnlistMapper.selectReturnBypage((page - 1) * pagesize, pagesize);
        return returnlists;
    }
}
